/*
 * @Author: xiaosihan
 * @Date: 2021-03-28 18:50:42
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2021-08-05 00:19:51
 */

import globalStore from "@globalStore";
import ReactMixinComponent from "@ReactMixinComponent";
import { Switch } from "antd";
import * as React from "react";
import styles from "./DevBtn.less";

interface Props { }

interface State {
    dev: boolean
}

export class DevBtn extends ReactMixinComponent<Props, State> {
    constructor(props: Props) {
        super(props);

    }

    state: State = {
        dev: globalStore.dev
    }

    componentDidMount() {
        this.mixin_autorun(() => {
            const { dev } = globalStore;
            this.setState({ dev });
        });
    }

    render() {
        const { dev } = this.state;

        return (
            <div className={styles.DevBtn} >
                开发模式 :
                <Switch
                    checked={dev}
                    onChange={dev => {
                        globalStore.dev = dev;
                    }}
                />
            </div>
        );
    }
}